/*
 * Questa classe rappresenta un link fisico.
 * Un link fisico è un collegamento diretto (1 hop) tra 2 AS (neighboor)
 */

using namespace std;

class PhysicalLink
{
    private:
	int ASOrigin;           //uso un intero che sarebbe l'indice del vettore degli AS,
	int ASDestination;      //non metto direttamente l'oggetto AS, che creerebbe ridondanza
	string policy;
	int bandwidth;
	int bandwidthUsage;
    int latency;
	bool state;

	public:
	PhysicalLink();
	PhysicalLink(int ASOrigin, int ASDestination, string policy, int bandwidth, int latency, bool state);
	int getASOrigin();
	int getASDestination();
	string getPolicy();
	int getBandwidth();
	bool setBandwidth(int bandwidth);
	int getBandwidthUsage();
	bool addBandwidthUsage(int bandwidth);
	bool removeBandwidthUsage(int bandwidth);
	bool resetBandwidthUsage();
	int getLatency();
	bool setLatency(int latency);
	bool getState();
	bool setState(bool state);
};

PhysicalLink::PhysicalLink()
{;}

PhysicalLink::PhysicalLink(int ASOrigin, int ASDestination, string policy, int bandwidth, int latency, bool state)
{
	this->ASOrigin = ASOrigin;
    this->ASDestination = ASDestination;
    this->policy = policy;
    this->bandwidth = bandwidth;
    this->bandwidthUsage = 0;
	this->latency = latency;
    this->state = state;
}

int PhysicalLink::getASOrigin()
{
    return this->ASOrigin;
}

int PhysicalLink::getASDestination()
{
    return this->ASDestination;
}

string PhysicalLink::getPolicy()
{
    return this->policy;
}

int PhysicalLink::getBandwidth()
{
    return this->bandwidth;
}

bool PhysicalLink::setBandwidth(int bandwidth)
{
    this->bandwidth = bandwidth;
}

int PhysicalLink::getBandwidthUsage()
{
    return bandwidthUsage;
}

bool PhysicalLink::addBandwidthUsage(int bandwidth)
{
    bandwidthUsage = bandwidthUsage + bandwidth;
}

bool PhysicalLink::removeBandwidthUsage(int bandwidth)
{
    bandwidthUsage = bandwidthUsage - bandwidth;
}

bool PhysicalLink::resetBandwidthUsage()
{
    bandwidthUsage = 0;
}

int PhysicalLink::getLatency()
{
    return this->latency;
}

bool PhysicalLink::setLatency(int latency)
{
    this->latency = latency;
}

bool PhysicalLink::getState()
{
    return this->state;
}

bool PhysicalLink::setState(bool state)
{
    this->state = state;
}
